﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////


#pragma once

#include "GcmpSnapInterface.h"
#include "IObject.h"
#include "IGeometry.h"

namespace gcmp
{
    class IGeometry;
    class IModelView;
    class Vector3d;
    class IElement;
    struct LocalCustomPointSnapData;

    /// \brief 远程捕捉数据
    struct GCMP_SNAP_INTERFACE_EXPORT RemoteSnapData
    {
        /// \brief 构造远程捕捉数据
        /// 
        /// \param opGeometry 远程捕捉几何辅助线
        /// \param tag 远程捕捉标签
        RemoteSnapData(OwnerPtr<IGeometry> opGeometry, int tag)
            : Geometry(TransferOwnership(opGeometry))
            , Tag(tag)
        {
        }

        OwnerPtr<IGeometry> Geometry;                  ///< 远程捕捉几何辅助线
        const int Tag;                                 ///< 远程捕捉标签
    };

    /// \brief 捕捉策略接口
    class GCMP_SNAP_INTERFACE_EXPORT IElementSnapStrategy : public IObject
    {
        DEFINE_CAST_DERIVED(gcmp::IElementSnapStrategy, gcmp::IObject);
    public:
        /// \brief 析构函数
        virtual ~IElementSnapStrategy() {}

        /// \brief 获得远程捕捉几何辅助线
        ///
        /// \param pModelView 当前视图
        /// \param pElement 当前对象
        /// \return 一组用于远程捕捉的数据
        virtual std::vector<RemoteSnapData> GetRemoteSnappableGeometry(const IModelView* pModelView, const IElement* pElement) const = 0;

        /// \brief 获得自定义近程捕捉点的数据
        /// 
        /// \param pElement 当前对象
        /// \param pModelView 当前视图
        /// \param snapDatas 自定义近程捕捉点的数据
        /// \return 
        virtual void GetLocalCustomPointSnapData(const IElement* pElement, const IModelView* pModelView, std::vector<LocalCustomPointSnapData>& snapDatas) const = 0;
    };
}




